package cn.wolfcode.trip.web.controller;

import cn.wolfcode.trip.base.util.QiniuCloudUtil;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.multipart.MultipartFile;

import java.util.HashMap;
import java.util.Map;

@Controller
@RequestMapping("/image")
public class ImageController {
    @RequestMapping("/upload")
    @ResponseBody
    public Object uploadImage(MultipartFile upload) {
        String url = QiniuCloudUtil.uploadQiniu(upload);
        Map<String, Object> map = new HashMap<>();
        map.put("url", url);
        map.put("uploaded", 1);
        return map;
    }

}
